<template>
	<!--专家信息管理-->
	<div class="container-app">
		<div style="margin-bottom:15px;">
			<el-button v-if="hasAdd" size="small" type="success" @click="addLine"><i class="el-icon-plus"></i>{{addTitle}}</el-button>
			<el-button v-if="hasDel" size="small" type="danger" @click="removeLine"><i class="el-icon-delete"></i>{{delTitle}}</el-button>
			<el-button v-if="hasUpdate" size="small" type="primary" @click="changeLine"><i class="el-icon-edit-outline"></i>{{updateTitle}}</el-button>
			<span class="right-search">
	        <el-input @change="findLine" v-model="findData" class="listinput" size="small" placeholder="输入关键字搜索" style="width:300px;">
	          <el-button @click="findLine" slot="append" icon="el-icon-search"></el-button>
	        </el-input>
	        <el-button @click="resetLine" size="mini"><i class="el-icon-refresh"></i>重置</el-button>
	      </span>
		</div>
		<!--专家信息管理列表-->
		<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
		  <el-tab-pane label="专家信息" name="1">
		  		<el-table @selection-change="getRow" :data="tableData" tooltip-effect="dark" style="width: 100%" border v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
					<el-table-column type="selection" width="55"></el-table-column>
					<el-table-column prop="epName" label="专家姓名"></el-table-column>
					<el-table-column prop="epType" label="专家类型">
						<template slot-scope="scope">{{scope.row.epType | formatepType}}</template>
					</el-table-column>
					<el-table-column prop="epGschool" label="毕业院校"></el-table-column>
					<el-table-column prop="gradTime" label="毕业时间"></el-table-column>
					<el-table-column prop="epTpost" label="职称"></el-table-column>
					<el-table-column prop="epOrgzt" label="工作单位"></el-table-column>
					<el-table-column prop="sdResTime" label="发布时间"></el-table-column>
					<el-table-column prop="adStatus" label="审核状态">
						<template slot-scope="scope">
							<span v-if="scope.row.adStatus == 1" style="color: green;">通过</span>
							<span v-else-if="scope.row.adStatus == 0" style="color: #de8a09;">不通过</span>
							<span v-else></span>
						</template>
					</el-table-column>
					<el-table-column label="操作" width="220">
						<template slot-scope="scope">
							<el-button type="success" size="mini" @click="viewLine(scope.row)">
								<i class="el-icon-check"></i> 查看详情
							</el-button>
							<el-button v-if="hasCheck" size="small" type="primary" @click="checkLine(scope.row)"><i class="el-icon-plus"></i>{{checkTitle}}</el-button>
						</template>
					</el-table-column>
				</el-table>
				<el-col :span="24" class="paging">
					<span>总条数：{{dataTotal}}</span>
					<el-pagination @current-change="changePage" :page-size="10" :total="dataTotal" background layout="prev, pager, next" style="float:right;"></el-pagination>
				</el-col>
		  </el-tab-pane>
		  <el-tab-pane label="科技人才" name="2">
		  		<el-table @selection-change="getRow" :data="tableData" tooltip-effect="dark" style="width: 100%" border v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
					<el-table-column type="selection" width="55"></el-table-column>
					<el-table-column prop="epName" label="专家姓名"></el-table-column>
					<el-table-column prop="epType" label="专家类型">
						<template slot-scope="scope">{{scope.row.epType | formatepType}}</template>
					</el-table-column>
					<el-table-column prop="epGschool" label="毕业院校"></el-table-column>
					<el-table-column prop="gradTime" label="毕业时间"></el-table-column>
					<el-table-column prop="epTpost" label="职称"></el-table-column>
					<el-table-column prop="epOrgzt" label="工作单位"></el-table-column>
					<el-table-column prop="sdResTime" label="发布时间"></el-table-column>
					<el-table-column prop="adStatus" label="审核状态">
						<template slot-scope="scope">
							<span v-if="scope.row.adStatus == 1" style="color: green;">通过</span>
							<span v-else-if="scope.row.adStatus == 0" style="color: #de8a09;">不通过</span>
							<span v-else></span>
						</template>
					</el-table-column>
					<el-table-column label="操作" width="220">
						<template slot-scope="scope">
							<el-button type="success" size="mini" @click="viewLine(scope.row)">
								<i class="el-icon-check"></i> 查看详情
							</el-button>
							<el-button v-if="hasCheck" size="small" type="primary" @click="checkLine(scope.row)"><i class="el-icon-plus"></i>{{checkTitle}}</el-button>
						</template>
					</el-table-column>
				</el-table>
				<el-col :span="24" class="paging">
					<span>总条数：{{dataTotal}}</span>
					<el-pagination @current-change="changePage" :page-size="10" :total="dataTotal" background layout="prev, pager, next" style="float:right;"></el-pagination>
				</el-col>
		  </el-tab-pane>
		</el-tabs>
		
		<!--新增修改对话界面-->
		<el-dialog :title="title" :visible.sync="isDialog" width="60%" :before-close="handleClose" :close-on-click-modal='false' v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
			<el-form size="small" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="form-submit">
				<el-form-item label="专家名称：" prop="epName">
		          <el-input size="small" v-model="ruleForm.epName"  placeholder="请输入专家名称" maxlength="10"></el-input>
		        </el-form-item>
		        <el-form-item label="专家信息：" prop="epType">
		          	<el-radio v-model="ruleForm.epType" @change='changeEptype' label="1" border>专家信息</el-radio>
    				<el-radio v-model="ruleForm.epType" @change='changeEptype' label="2" border>科技人才</el-radio>
		        </el-form-item>
		        <el-form-item label="毕业院校：" prop="epGschool">
		          <el-input size="small" v-model="ruleForm.epGschool"  placeholder="请输入毕业院校" maxlength="50"></el-input>
		        </el-form-item>
				<el-form-item label="毕业时间：" prop="gradTime">
					<el-date-picker type="date" value-format="yyyy-MM-dd" style="width:100%" v-model="ruleForm.gradTime" placeholder="请输入毕业时间"></el-date-picker>
				</el-form-item>
				<el-form-item label="职称：" prop="epTpost">
					<el-input size="small" v-model="ruleForm.epTpost" placeholder="请输入职称" maxlength="50"></el-input>
				</el-form-item>
				<el-form-item label="职业资格：" prop="epQualt">
					<el-input size="small" v-model="ruleForm.epQualt" placeholder="请输入职业资格" maxlength="30"></el-input>
				</el-form-item>
				<el-form-item label="工作单位：" prop="epOrgzt">
					<el-input size="small" v-model="ruleForm.epOrgzt" placeholder="请输入工作单位" maxlength="50"></el-input>
				</el-form-item>
				<el-form-item label="工作单位类型：" prop="orgType">
					<el-input size="small" v-model="ruleForm.orgType" placeholder="请输入工作单位类型" maxlength="30"></el-input>
				</el-form-item>
				<el-form-item label="专家照片：" prop="epPic" class="avatar-uploader">				
					<el-upload
					  class="avatar-uploader"
					  :action="action"
					  :show-file-list="false"
					  :on-success="handleAvatarSuccess">
					  <img v-if="imageUrl" :src="imageUrl" class="avatar">
					  <i v-else class="el-icon-plus avatar-uploader-icon"></i>
					</el-upload>
				</el-form-item>
				<el-form-item label="专家简介：" prop="epDetail">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epDetail" maxlength="500" placeholder="请输入专家简介"></el-input>
				</el-form-item>
				<el-form-item label="主要成就：" prop="epAcvmt">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epAcvmt" maxlength="500" placeholder="请输入主要成就"></el-input>
				</el-form-item>
				<el-form-item label="研究方向：" prop="epDirect">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epDirect" maxlength="500" placeholder="请输入研究方向"></el-input>
				</el-form-item>
				<el-form-item label="发布人：" prop="sdRealName">
					<el-autocomplete
					  v-model="ruleForm.sdRealName"
					  :fetch-suggestions="querySearchAsync"
					  placeholder="请输入内容"
					  @select="handleSelect" style="width: 100%;">
					  <template slot-scope="{ item }">
				    	<div class="name"><span>{{ item.userTel }}</span></div>
				  	  </template>
					</el-autocomplete>
				</el-form-item>
				<el-form-item label="发布时间：" prop="sdResTime">
					<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" style="width:100%" v-model="ruleForm.sdResTime" placeholder="请输入发布时间"></el-date-picker>
				</el-form-item>
				<el-form-item
					v-for="(modelVal, index) in modelList"
				    :label="modelVal.mdTitle +'：'"
				    :key="modelVal.mdId">
					<el-select v-model="modelVal.mdVId" clearable placeholder="请选择模块类型" @change="selectModel($event,modelVal,index)" style="width: 100%">
						<el-option
						 v-for="item in modelVal.mvList"
						 	:key="item.mvId"
							:label="item.mvTitle"
							:value="item.mvId">
						</el-option>
					</el-select>
	          </el-form-item>
			</el-form>
			<span slot="footer" style="padding-right:30px;">
	        	<el-button size="small" type="success" @click="submitForm('ruleForm')">保存</el-button>
	        	<el-button v-show="changeVisible" size="small" type="warning" @click="resetForm('ruleForm')">重置</el-button>
	       		<el-button size="small" @click="cancleForm('ruleForm')">取消</el-button>
	        </span>
		</el-dialog>
		<!--查看详情-->
		<el-dialog title="专家信息" :visible.sync="isDetails" width="60%" :before-close="handleClose" :close-on-click-modal='false' v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.5)">
			<el-form size="small" :model="ruleForm" ref="ruleForm" label-width="120px" class="form-submit">
				<el-form-item label="专家名称：" prop="epName">
		          <el-input size="small" v-model="ruleForm.epName" readonly></el-input>
		        </el-form-item>
		        <el-form-item label="专家信息：" prop="epType">
		          	<el-input size="small" v-model="ruleForm.epType" readonly></el-input>
		        </el-form-item>
		        <el-form-item label="毕业院校：" prop="epGschool">
		          <el-input size="small" v-model="ruleForm.epGschool" readonly></el-input>
		        </el-form-item>
				<el-form-item label="毕业时间：" prop="gradTime">
					<el-input size="small" v-model="ruleForm.gradTime" readonly></el-input>
				</el-form-item>
				<el-form-item label="职称：" prop="epTpost">
					<el-input size="small" v-model="ruleForm.epTpost" readonly></el-input>
				</el-form-item>
				<el-form-item label="职业资格：" prop="epQualt">
					<el-input size="small" v-model="ruleForm.epQualt" readonly></el-input>
				</el-form-item>
				<el-form-item label="工作单位：" prop="epOrgzt">
					<el-input size="small" v-model="ruleForm.epOrgzt" readonly></el-input>
				</el-form-item>
				<el-form-item label="工作单位类型：" prop="orgType">
					<el-input size="small" v-model="ruleForm.orgType" readonly></el-input>
				</el-form-item>
				<el-form-item label="专家照片：" prop="epPic">
					<img :src="ruleForm.epPic" style="width: 160px; height: 160px" />
				</el-form-item>
				<el-form-item label="专家简介：" prop="epDetail">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epDetail" readonly></el-input>
				</el-form-item>
				<el-form-item label="主要成就：" prop="epAcvmt">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epAcvmt" readonly></el-input>
				</el-form-item>
				<el-form-item label="研究方向：" prop="epDirect">
					<el-input type="textarea" resize="none" :rows="3" v-model="ruleForm.epDirect" readonly></el-input>
				</el-form-item>
				<el-form-item label="发布人：" prop="sdRealName">
					<el-input size="small" v-model="ruleForm.sdRealName" readonly></el-input>
				</el-form-item>
				<el-form-item label="发布时间：" prop="sdResTime">
					<el-input size="small" v-model="ruleForm.sdResTime" readonly></el-input>
				</el-form-item>
				<el-form-item
					v-for="(modelVal, index) in modelList"
				    :label="modelVal.mdTitle +'：'"
				    :key="modelVal.mdId">
					<template v-for="item in modelVal.mvList">
						<el-button v-if="item.mvId"  v-show="modelVal.mdVId == item.mvId" class="isactive" size="mini">{{item.mvTitle}}</el-button>
						<el-button v-if="item.mvId" v-show="modelVal.mdVId != item.mvId" size="mini">{{item.mvTitle}}</el-button>
						<!--<el-button size="mini" :class="!item.isactive">超小按钮</el-button>-->
					</template>
				</el-form-item>
			</el-form>
			<span slot="footer" style="padding-right:30px;">
        <el-button size="small" @click="cancleForm('ruleForm')">关闭</el-button>
      </span>
		</el-dialog>
	</div>
</template>

<script>
	import {      
		getserver,
		postserver,
		postjsonserver,
		getImgUrl
	} from '@/api/basicFunction'
	export default {
		data() {
			return {
				inputVisible: false,
				inputValue: '',
				isDetails: false,
				isDialog: false,
				loading: true,
				isUsable: 1,
				type: '1',
				action: process.env.SAVE_IMG_API+'transferMangeImg',
				imageUrl: '',
				activeName: '1',
				changeVisible: true,
				title:'新增专家信息',
				selectData: [],
				dataPage: 1,
				dataTotal: 1,
				tableData: [],
				stResidOptions: [],
				modelList:[],
				modelPropsList:[{
					mdId:'',
					mdTitle:'',
					mdType: '',
					mvId:'',
					mvTitle:''
				}],
				ruleForm: {
					id: '',
					epName:'',//专家姓名
					epGschool:'',//毕业院校
					gradTime:'',//毕业时间
					epTpost:'',//职称
					epQualt:'',//职业资格
					epOrgzt:'',//工作单位
					orgType:'',//工作单位类型
					epDetail:'',//专家简介
					epAcvmt:'',//主要成就
					epDirect:'',//研究方向
					sdResId:'',//发布人id
					sdRealName:'',//发布人名称
					sdResTime:'',//发布时间
					epPic:'',//专家照片
					epType:'1',//专家类型
				},
				removeIds: [],
				selectId: '',
				isAdd: true,
				findData: '',
				hasAdd: false,
				hasDel: false,
				hasUpdate: false,
				hasCheck: false,
				addTitle: '新增',
				updateTitle: '修改',
				delTitle: '删除',
				checkTitle: '审核',
				rules: {
					epName: [{
						required: true,
						trigger: 'blur',
						message: '请输入专家名称'
					}],
					sdResTime: [{
						required: true,
						trigger: 'blur',
						message: '请输入发布时间'
					}],
					sdRealName: [{
						required: true,
						trigger: 'blur',
						message: '请选择发布人'
					}],
					epType: [{
						required: true,
						trigger: 'blur',
						message: '请选择专家类型'
					}]
				},
			}
		},
		filters: {
			formatepType(value) {
				if(value == '1'){
					return '专家信息'
				}else if(value == '2'){
					return '科技人才'
				}else {
					return ''
				}
			},
		},
		mounted() {
			this.getPageList()
			this.getJur()
			this.getModelAllList(4)
		},
		methods: {
			querySearchAsync(queryString, callback) {
		    	let para ={}
		    	if(queryString) 
		    		para.keyword = queryString
		    	getserver(para, "/clientUser/search").then(res => {
					if(res.code == '200') {
						callback(res.data)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
		    },
			handleSelect(item) {
				this.ruleForm.sdRealName = item.userTel
				this.ruleForm.sdResId = item.id
			},
			getJur() {
				const self = this
				self.$store.dispatch('Juage', self.$store.clickMenuId).then(res => {
					if(res.code == '200') {
						res.data.forEach(item => {
							if(item.type == '3') {
								self.hasAdd = true
								self.addTitle = item.title
							}
							if(item.type == '5') {
								self.hasDel = true
								self.delTitle = item.title
							}
							if(item.type == '4') {
								self.hasUpdate = true
								self.updateTitle = item.title
							}
							if(item.type == '7') {
								self.hasCheck = true
								self.checkTitle = item.title
							}
						})
					} else if(res.code !== '507') {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			getPageList() {
				const para = {
					pageIndex: this.dataPage,
					pageSize: 10,
					expertType:this.type
				}
				this.loading = true
				getserver(para, "/expert/getPageList").then(res => {
					if(res.code == '200') {
						this.dataTotal = res.data.total
						this.tableData = res.data.records
						console.log(this.tableData)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
					this.loading = false
				})
			},
			getModelAllList(type){
				getserver({mdType:type}, "/md/getDetailAll").then(res => {
					if(res.code == '200') {
						let _arr =[]
						let _v = {
								mvId:'',
								mvTitle:'请选择模块值信息'
							}
						for(let i=0;i<res.data.length;i++){
							_arr.push({
								mdId:'',
								mdTitle:res.data[i].mdTitle,
								mdType: '',
								mvId:'',
								mvTitle:''
							})
							res.data[i].mdVId = ''
							res.data[i].mvList.unshift(_v)
						}
						this.modelPropsList = _arr;
						this.modelList = res.data
						console.log(this.modelPropsList,this.modelList)
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			selectModel(e,obj,index){
				for(let i=0;i<this.modelPropsList.length;i++){
					if(i == index){
						if(e){
							this.modelPropsList[i].mvId = e 
							this.modelPropsList[i].mdId = obj.mdId
							this.modelPropsList[i].mdType = obj.mdType 
							this.modelPropsList[i].mdTitle = obj.mdTitle 
						}else{
							this.modelPropsList[i].mvId = '' 
							this.modelPropsList[i].mdId = ''
							this.modelPropsList[i].mdType = ''
							this.modelPropsList[i].mdTitle = obj.mdTitle 
						}
						
					}
				}
			},
			changePage(val) {
				this.dataPage = val
				this.getPageList()
			},
			handleClose() {
				this.isDialog = false
				this.isDetails = false
			},
			submitForm(formName) {
				const self = this
				self.$refs[formName].validate((valid) => {
					if(valid) {
						let para = self.ruleForm
						let _tagList = []
						for(let i=0;i<self.modelPropsList.length;i++){
							if(self.modelPropsList[i].mdId){
								_tagList.push({'mdType':self.modelPropsList[i].mdType,'mdId':self.modelPropsList[i].mdId,'mvId':self.modelPropsList[i].mvId})
							}else{
								this.$message({
									type: 'error',
									message: '请先选择'+self.modelPropsList[i].mdTitle+'的模块值信息!'
								})
								return false
							}
						}
						para.tagList = _tagList
						para.sdResId = self.ruleForm.sdResId
						delete para.sdRealName
						if(self.isAdd) {
							delete para.id
							//添加信息
							postjsonserver(para, "/expert/add").then(res => {
								if(res.code == '200') {
									self.$message({
										type: 'success',
										message: res.message
									})
								} else {
									self.$message({
										type: 'error',
										message: res.message
									})
								}
								self.isDialog = false
								self.$refs[formName].resetFields()
								self.getPageList()
							})
						} else {
							//修改信息
							postjsonserver(para, "/expert/update").then(res => {
								if(res.code == '200') {
									self.$message({
										type: 'success',
										message: res.message
									})
									self.getPageList()
								} else {
									self.$message({
										type: 'error',
										message: res.message
									})
								}
								self.getPageList()
								self.isDialog = false
								self.$refs[formName].resetFields()
							})
						}
					} else {
						console.log('error submit!!')
						return false
					}
				})
			},
			resetForm(formName) {
				this.$refs[formName].resetFields()
				//this.restData()
			},
			cancleForm(formName) {
				this.$refs[formName].resetFields()
				this.isDialog = false
				this.isDetails = false
			},
			removeLine() {
				if(this.selectData.length) {
					this.$confirm('删除该数据, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						const para = {
							ids: this.removeIds.toString()
						}
						this.loading = true
						postserver(para, "/expert/delete").then(res => {
							if(res.code == '200') {
								this.$message({
									type: 'success',
									message: res.message
								})
								this.getPageList()
							} else {
								this.$message({
									type: 'success',
									message: res.message
								})
							}
							this.loading = false
						})
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消删除'
						})
					})
				} else {
					this.$message('请先选择需要删除的信息！')
				}
			},
			restData() {
				const self = this
				self.ruleForm.id = ''
				self.ruleForm.epName = ''
				self.ruleForm.epGschool = ''
				self.ruleForm.gradTime = ''
				self.ruleForm.epTpost = ''
				self.ruleForm.ctPeople = ''
				self.ruleForm.epQualt = ''
				self.ruleForm.epOrgzt = ''
				self.ruleForm.orgType = ''
				self.ruleForm.epDetail = ''
				self.ruleForm.epAcvmt = ''
				self.ruleForm.epDirect = ''
				self.ruleForm.sdResId = ''
				self.ruleForm.sdRealName = ''
				self.ruleForm.sdResTime = ''
				self.ruleForm.epPic = ''
				self.imageUrl =''
			},
			addLine() {
				const self = this
				self.title = '新增专家信息'
				self.ruleForm.epType = String(self.activeName)
				self.isDialog = true
				self.changeVisible = true
				self.isAdd = true
				self.isWine = false
				self.restData()
			},
			changeLine() {
				const self = this
				if(self.selectData.length && self.selectData.length === 1) {
					self.isAdd = false
					self.title = '修改专家信息'
					self.loading = true
					getserver({id:self.selectData[0].id}, "/expert/info").then(res => {
						if(res.code == '200') {
							self.ruleForm.id = res.data.id
							//modelList  mdVId
							res.data.tagList.forEach(item => {
								for(let i=0;i<self.modelList.length;i++){
									self.modelList[i].mvList.forEach(item1 => {
										if(item1.mvId == item.mvId){
											this.modelPropsList[i].mvId = item.mvId
											this.modelPropsList[i].mdId = item.mdId
											this.modelPropsList[i].mdType = item.mdType
											this.modelPropsList[i].mdTitle = item.mdTitle
											this.modelPropsList[i].mvTitle = item.mvTitle
											self.modelList[i].mdVId = item.mvId
										}
									})
								}
							})
							
							self.ruleForm.id = res.data. id
							self.ruleForm.epName = res.data.epName
							self.ruleForm.epGschool = res.data.epGschool
							self.ruleForm.gradTime = res.data.gradTime
							self.ruleForm.epTpost = res.data.epTpost
							self.ruleForm.ctPeople = res.data.ctPeople
							self.ruleForm.epQualt = res.data.epQualt
							self.ruleForm.epOrgzt = res.data.epOrgzt
							self.ruleForm.orgType = res.data.orgType
							self.ruleForm.epDetail = res.data.epDetail
							self.ruleForm.epAcvmt = res.data.epAcvmt
							self.ruleForm.epDirect = res.data.epDirect
							self.ruleForm.sdResId = res.data.sdResId
							self.ruleForm.sdRealName = res.data.sdPhone
							self.ruleForm.sdResTime = res.data.sdResTime
							self.ruleForm.epPic = res.data.epPic
							self.ruleForm.epType = String(res.data.epType)
							self.imageUrl = res.data.epPic//以前是相对路径，现改为绝对路径
						} else {
							this.$message({
								type: 'error',
								message: res.message
							})
						}
						self.loading = false
					})
					
					self.isDialog = true
					self.changeVisible = false
					self.isWine = false
					
					self.selectId = self.selectData[0].id
				} else {
					this.$message({
							type: 'warning',
							message: '请选择一条信息进行修改！'
						})
				}
			},
			getRow(selection) {
				const self = this
				self.removeIds = []
				self.selectData = selection
				selection.forEach(item => {
					self.removeIds.push(item.id)
				})
			},
			findLine() {
				//let keyword = encodeURIComponent(this.findData)
				const para = {
					row: 10,
					page: 1,
					keyword: this.findData
				}
				this.loading = true
				//关键字搜索行
				postserver(para, "/expert/getPageList").then(res => {
					if(res.code == '200') {
						this.loading = false
						this.dataTotal = res.data.total
						this.tableData = res.data.records
					} else {
						this.$message({
							type: 'error',
							message: res.message
						})
					}
				})
			},
			resetLine() {
				this.findData = ''
			},
			//选中专家类型
			changeEptype(val){
				console.log(val);
				if(val == 1){
					this.getModelAllList(4)
				}else{
					this.getModelAllList(3)
				}
				
			},
			viewLine(obj) {
				const self = this
				self.loading = true
				getserver({id:obj.id}, "/expert/info").then(res => {
						if(res.code == '200') {
							self.ruleForm.id = res.data.id
							res.data.tagList.forEach(item => {
									for(let i=0;i<self.modelList.length;i++){
										self.modelList[i].mvList.forEach(item1 => {
											if(item1.mvId == item.mvId){
												self.modelList[i].mdVId = item.mvId
											}
										})
									}
								})
							
							self.ruleForm.epName = res.data.epName
							self.ruleForm.epGschool = res.data.epGschool
							self.ruleForm.gradTime = res.data.gradTime
							self.ruleForm.epTpost = res.data.epTpost
							self.ruleForm.ctPeople = res.data.ctPeople
							self.ruleForm.epQualt = res.data.epQualt
							self.ruleForm.epOrgzt = res.data.epOrgzt
							self.ruleForm.orgType = res.data.orgType
							self.ruleForm.epDetail = res.data.epDetail
							self.ruleForm.epAcvmt = res.data.epAcvmt
							self.ruleForm.epDirect = res.data.epDirect
							self.ruleForm.sdResId = res.data.sdResId
							self.ruleForm.sdRealName = res.data.sdPhone
							self.ruleForm.sdResTime = res.data.sdResTime
							self.ruleForm.epPic = res.data.epPic//以前是相对路径，现改为绝对路径
							self.ruleForm.epType = self.$options.filters['formatepType'](res.data.epType)
						} else {
							this.$message({
								type: 'error',
								message: res.message
							})
						}
						self.loading = false
					})
				self.isDetails = true
				self.selectId = obj.id
			},
			handleClick() {//type
				this.type = this.activeName
//				if(this.activeName ==1){
//					this.getModelAllList(4)
//				}else {
//					this.getModelAllList(3)
//				}
		       	this.getPageList()
		    },
		    handlePreview(file) {
		    },
		    handleAvatarSuccess(res, file) {
		        this.imageUrl = URL.createObjectURL(file.raw);
		        this.ruleForm.epPic = process.env.GET_IMG_API + res.result
		    },
		      beforeAvatarUpload(file) {
		      	console.log(file)
		        const isJPG = file.type === 'image/jpeg';
		        const isLt2M = file.size / 1024 / 1024 < 2;
		
		     /*   if (!isJPG) {
		          this.$message.error('上传头像图片只能是 JPG 格式!');
		        }
		        if (!isLt2M) {
		          this.$message.error('上传头像图片大小不能超过 2MB!');
		        }*/
		        return isJPG && isLt2M;
		      },
			checkLine(obj){
				if(obj.adStatus == 1){
					this.$message('当前数据已审核通过！')
				}else{
					this.$confirm('审核该数据, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						const para = {
							id: obj.id
						}
						postserver(para, "/expert/check").then(res => {
							if(res.code == '200') {
								this.$message({
									type: 'success',
									message: res.message
								})
								this.getPageList()
							} else {
								this.$message({
									type: 'success',
									message: res.message
								})
							}
						})
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消审核'
						})
					})
				}
			}
		}
	}
</script>

<style scoped>
	.paging {
		padding: 15px;
		padding-right: 0;
	}
	
	.form-submit {
		margin: 0;
		padding-right: 30px;
	}
	
	.el-dialog__header {
		text-align: center;
	}
	.tree-box{
		height: 180px;
	    overflow: auto;
	    z-index: 999;
	    width: 100%;
	}
	.el-tree{
		min-height: 120px;
	}
	.tree-box{
		padding: 20px;
	    border: 1px solid #dedede;
	    position: absolute;
	    z-index: 999;
	    width: 100%;
	    background: #f1f1f1;
	    margin-top: 10px;
    }
    .tree-box div.triangle{
    	width: 0;
	    height: 0;
	    border-width: 10px;
	    border-style: solid;
	    border-color: transparent transparent #f1f1f1 transparent;
	    font-size: 0;
	    line-height: 0;
	    position: absolute;
	    top: -20px;
    }
    .isactive{
    	background: #1580ef;
    	color: #fff;
    }
   
</style>
<style>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }

</style>